home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 13662 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.6 KB

  1. Path: news1.interserv.net!news
  2. From: Jerry Houston <jhouston@Salsa.WallData.com>
  3. Newsgroups: comp.object,comp.lang.eiffel,comp.lang.c++,comp.lang.beta,comp.lang.java,comp.lang.sather
  4. Subject: Re: What Should An Exception Handling Do? -- Clarification of rules
  5. Date: Tue, 26 Mar 1996 10:14:24 -0800
  6. Organization: Wall Data - Salsa Products Division
  7. Message-ID: <31583400.4CF9@Salsa.WallData.com>
  8. References: <Doq3sv.MzA@research.att.com> <1996Mar25.160702.14229@schbbs.mot.com>
  9. NNTP-Posting-Host: 89184.walldata.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0GoldB1 (Win95; I)
  14.  
  15. David L. Shang wrote:
  16.  
  17. [snip]
  18.  
  19. > But I don't see what's wrong with the cynic. It is true that to
  20. > implement resumable exceptions in C++ is very hard. It is also
  21. > true that resumable exception is useful, see below.
  22.  
  23. [snip]
  24.  
  25. > The definition:
  26. > >       "Exception handling is intended to allow code that has encountered
  27. > >a condition it cannot cope with to return to some other code that
  28. > >directly or indirectly invoked it. There is no way for an exception
  29. > >handler to request the thread of control to resume from the throw point.
  30. > >In other words, "throw" implements the termination model of exception
  31. > >handling."     -ARM, Ellis & Stroustrup, page 354
  32.  
  33. [snip,snip]
  34.  
  35. I agree with the comments you made (and I snipped out), but one point 
  36. you didn't make in your reply was the location where execution resumes. 
  37.  In the earlier quotation from ARM, "...from the throw point..." is the 
  38. operative phrase.  I think there might be people here who otherwise 
  39. would be agreeing with each other, that are instead arguing.
  40.  
  41. Resumption from the original invocation of a set of code that might 
  42. throw an exception (from the try{} block) is considerably different from 
  43. resumption from the point at which the error was detected.  I have used 
  44. a method such as you described for so long, and with such complete 
  45. success, that I can't imagine anyone's finding fault with it.
  46.  
  47. For any exception that might warrent user interaction, rather than just 
  48. a "You're Screwed" message, I always include a [Retry] button for the 
  49. user to click after first fixing the problem.  It passes control to the 
  50. beginning of the try{} block.  (This is one of the few places where my 
  51. coding standard allows "goto," even in C++.)   
  52.  
  53. Obviously, this kind of handling isn't always appropriate, but in a case 
  54. where execution can sometimes continue based on the user's having 
  55. intervened in some way (such as moving a file, providing a valid path, 
  56. shutting down some other process that interferes with this one, etc.)it 
  57. makes a lot of sense.
  58.